<?php
$imgurl    = $this->getSkinUrl('pms/images/8.jpg');
$formdata  = $this->getFormdata();
$data      = $formdata['form_data'];
$websiteId = $formdata['website_id'];
$temp      = json_decode($data, true);
?>
<div style="width: 65%;height: auto;float: left;">
    <div class="entry-edit">
        <div class="entry-edit-head">
            <h4 class="icon-head head-edit-form fieldset-legend">模板参数</h4>
            <div class="form-buttons"></div>
        </div>
        <div class="fieldset  ignore-validate" id="coupons_information_fieldset">
            <div class="hor-scroll">
                <div class="hor-scroll">
                    <table cellspacing="0" class="form-list">
                        <tbody>
                        <tr>
                            <td class="label"><label>A--Banner</label></td>
                            <td class="value">
                                <input type="file" name="image[banner][]"/><p class="note" id="note_dash"><span>上传图片宽:720px;高:642px;</span></p>
                                <input type="checkbox" name="images[banner]" value="1" class="checkbox" id="image_banner_delete">
                                <label for="image_banner_delete">是否删除图片</label>
                                <?php if($temp['image']['banner']):?>
                                    <p class="note" id="note_dash"><span><a href="<?php echo $baseurl.$temp['image']['banner']?>" target="_blank">预览已上传图片</a></span></p>
                                <?php endif;?>
                            </td>
                        </tr>

                        <tr>
                            <td class="label"><label>A1-1--活动说明文字</label></td>
                            <td class="value">
                                <?php if($temp && $temp['active_notes']):?>
                                    <textarea name="form_data[active_notes]" class="input-text required-entry" style="width: 274px;height: 40px;"><?php echo $temp['active_notes'];?></textarea>
                                <?php else: ?>
                                    <textarea name="form_data[active_notes]" class="input-text required-entry" style="width: 274px;height: 40px;"></textarea>
                                <?php endif; ?>
                            </td>
                        </tr>

                        <tr>
                            <td class="label"><label>A2--重点推荐标题栏</label></td>
                            <td class="value">
                                <input type="file" name="image[hot][]"/><p class="note" id="note_dash"><span>上传图片宽:538px;高:117px;</span></p>
                                <input type="checkbox" name="images[hot]" value="1" class="checkbox" id="image_hot_delete">
                                <label for="image_hot_delete">是否删除图片</label>
                                <?php if($temp['image']['hot']):?>
                                    <p class="note" id="note_dash"><span><a href="<?php echo $baseurl.$temp['image']['hot']?>" target="_blank">预览已上传图片</a></span></p>
                                <?php endif;?>
                            </td>
                        </tr>

                        <tr>
                            <td class="label"><label>A3--重点推荐商品SKU</label></td>
                            <td class="value">
                                <input type="button" value="添加商品" data-id="1" onclick="addsku(this)"/><p class="note" id="note_dash"><span>最多上传3个产品;</span></p>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td class="add_dsku">
                                <ul style="border-top: 1px solid #ccc;border-bottom:1px solid #ccc;">
                                    <?php if($temp && $temp['sku1']):?>
                                        <?php foreach($temp['sku1'] as $sku): ?>
                                            <li>
                                                <input type="hidden" name="form_data[sku1][]" value="<?php echo $sku?>"/><?php echo $this->getproductBysku($sku, $websiteId)[0]['storename'];?>
                                                <span class="del_product" style="float: right;cursor: pointer;color: red;">删除</span>
                                            </li>
                                        <?php endforeach; ?>
                                    <?php endif; ?>
                                </ul>
                            </td>
                        </tr>

                        <tr>
                            <td class="label"><label>A4--普通推荐标题栏</label></td>
                            <td class="value">
                                <input type="file" name="image[activity][]"/><p class="note" id="note_dash"><span>上传图片宽:538px;高:117px;</span></p>
                                <input type="checkbox" name="images[activity]" value="1" class="checkbox" id="image_activity_delete">
                                <label for="image_activity_delete">是否删除图片</label>
                                <?php if($temp['image']['activity']):?>
                                    <p class="note" id="note_dash"><span><a href="<?php echo $baseurl.$temp['image']['activity']?>" target="_blank">预览已上传图片</a></span></p>
                                <?php endif;?>
                            </td>
                        </tr>


                        <tr>
                            <td class="label"><label>A5--普通推荐产品SKU</label></td>
                            <td class="value">
                                <input type="button" value="添加商品" data-id="2" onclick="addsku(this)"/><p class="note" id="note_dash"><span>上传产品个数最好是偶数个,不选择产品则隐藏该区域;</span></p>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td class="add_dsku">
                                <ul style="border-top: 1px solid #ccc;border-bottom:1px solid #ccc;">
                                    <?php if($temp && $temp['sku2']):?>
                                        <?php foreach($temp['sku2'] as $sku): ?>
                                            <li>
                                                <input type="hidden" name="form_data[sku2][]" value="<?php echo $sku?>"/><?php echo $this->getproductBysku($sku,$websiteId)[0]['storename'];?>
                                                <span class="del_product" style="float: right;cursor: pointer;color: red;">删除</span>
                                            </li>
                                        <?php endforeach; ?>
                                    <?php endif; ?>
                                </ul>
                            </td>
                        </tr>
                        <tr>
                            <td class="label"><label>A6--返回顶部图片</label></td>
                            <td class="value">
                                <input type="file" name="image[totop][]" /><p class="note" id="note_dash"><span>上传图片宽:137px;高:137px;</span></p>
                                <input type="checkbox" name="images[totop]" value="1" class="checkbox" id="image_totop_delete">
                                <label for="image_totop_delete">是否删除图片</label>
                                <?php if($temp['image']['totop']):?>
                                    <p class="note" id="note_dash"><span><a href="<?php echo $baseurl.$temp['image']['totop']?>" target="_blank">预览已上传图片</a></span></p>
                                <?php endif;?>
                            </td>
                        </tr>
                        <tr>
                            <td class="label"><label for="moreurl">查看更多链接</label></td>
                            <td class="value">
                                <input type="text" name="form_data[moreurl]" value="<?php echo $temp['moreurl']?$temp['moreurl']:"";?>" class="required-entry input-text" placeholder="请输入完整路径的链接地址"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="label"><label for="defaultimg">重置图片为默认状态</label></td>
                            <td class="value">
                                <button id="resetimg" name="resetimg" color="#00dcc6" title="点击重置" type="button" class="resets"><span><span><span>重置图片</span></span></span></button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="addsku" style="display:none;"><?php echo $this->getLayout()->createBlock('pms/adminhtml_activity_addsku')->toHtml(); ?></div>
<!-- right area   -->
<div id="right" style="width:30%;height: auto;float: right">
    <img src = "<?php echo $imgurl; ?>" style="width:100%"  style="width:100%"/>
</div>
<script>
    $j("#resetimg").click(function(){
        var flag = confirm("确认要重置所有图片为默认状态？");
        if(flag){
            var html='<input type="hidden" name="defaultimg" value="defaultimg" class="input-text"/>';
            $j("#resetimg").append(html);
            editForm.submit();
        }
    });
</script>